pro test_mie

  ; define consts and vars
  pi=3.1415926D;
  lambda=0.5 ; um
;  r=(findgen(1000)+5e-1)*0.01 ; um
  Cm=Dcomplex(1.33,-0.01) ; complex refractive index
  Dx=(findgen(1000)+1)*0.1
;  Dx=2*pi*r/lambda ; particle size parameters
  angle=findgen(101)/100*2*pi
  cosAngle=Cos(angle)
  
  Mie_single,Dx,Cm,Dqxt,Dqsc,Dqbk,Dg;,Xs1,Xs2,Dph,dqv=cosAngle
  print,'Dx=',Dx
  print,'Cm=',Cm
  print,'Dqxt=',Dqxt
  print,'Dqsc=',Dqsc
  print,'Dqbk=',Dqbk
  print,'Dg=',Dg
  help,Dph
;  print,'Xs1=',Xs1
;  print,'Xs2=',Xs2
;  print,'Dph=',Dph
  
  ; plot Dph
;  LOADCT,0
  WINDOW,xsize=1000,ysize=700
  if FILE_TEST('E:\Dph_rotate.gif') then FILE_DELETE,'E:\Dph_rotate.gif'
;  for angl=0,35 do begin
;    Scale3,AZ=(angl*10);,AX=angl/36*45
;    shade_surf,Alog(Dph),angle*360/2/pi,Dx,$
;        xtitle='Angle (degree)',ytitle='Size parameter',ztitle='Log(Phase function)',$
;        charsize=4,/T3D
;    write_gif,'E:\Dph_rotate.gif',TVRD(),delay_time=0.1,/multiple
;    wait,0.1
;  endfor
  plot,Dx,Dqxt-Dqsc
  plot,Dx,Dg
;  write_gif,/close
;  plot,angle*360/2/pi,Dph[*,1]
end
